﻿using System;
using Microsoft.EntityFrameworkCore;


namespace _074.EFCore_Mysql乐观并发控制
{
	public class MyDbContext : DbContext
	{
		public DbSet<House> Houses { get; set; }
		protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
		{
			base.OnConfiguring(optionsBuilder);
			string connStr = "Server=10.34.10.12;Database=fanzhineng;User ID=root;Password=Ziyang0505;";
			optionsBuilder.UseMySql(connStr, new MySqlServerVersion(new Version(8, 0, 32)));


		}
		protected override void OnModelCreating(ModelBuilder modelBuilder)
		{
			base.OnModelCreating(modelBuilder);
			// 从当前程序集加载所有的IEntityTypeConfiguration
			modelBuilder.ApplyConfigurationsFromAssembly(this.GetType().Assembly);

		}

	}
}
